<?php
session_start();
$isadmin=1;
include_once '../comm/config.php';
include_once('../comm/class_db.php');
$id = sel_sql("duoduo2010", "Id", "adminname='" . $_SESSION["adminusername"] . "'");
$role_id = sel_sql("duoduo2010", "role_id", "adminname='" . $_SESSION["adminusername"] . "'");
$access = sel_arr_sql("access a," . $BIAOTOU . "duoduo2010 d," . $BIAOTOU . "menu m", "a.*,m.name as name,m.url as url", "a.role_id=" . $role_id . " and d.adminname='" . $_SESSION["adminusername"] . "' and a.menu_id=m.id and m.status=1 group by a.menu_id order by m.listorder  desc,m.id asc");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>管理菜单</title>
	<link rel="stylesheet" type="text/css" href="css/sdmenu.css" />
	<script type="text/javascript" src="js/sdmenu.js">
	</script>
	<script type="text/javascript">
	// <![CDATA[
	var myMenu;
	window.onload = function() {
		myMenu = new SDMenu("my_menu");
		myMenu.init();
	};
	// ]]>
	</script>
	</head>
	<body style="background:#eef2fb">
    <div style="float: left" id="my_menu" class="sdmenu">
      <?php foreach($access as $kk => $rr) {

	?>
      <?php if ($rr["parentid"] == 0) {
		echo '<div class="';
		if ($kk == 0) {
			echo "current";
		} else {
			echo "collapsed";
		} 
		echo '"><span>' . $rr["name"] . '</span>';
		foreach($access as $kkk => $rrr) {
			if ($rrr["parentid"] == $rr["menu_id"]) {
				echo ' <a href="' . $rrr["url"] . '" target="main">' . $rrr["name"] . '</a>';
			} 
		} 
		echo "</div>";
	} 

	?>
      <?php } 
?>
    </div>
</body>
</html>